<?php

namespace app\admin\validate;

use think\Validate;

class NavValidate extends Validate{

    protected $rule = [
        'nav_id' => 'require|number',
        'nav_name' => 'require',
        'nav_seat' => ['require','number','in' => '1,2,3,4,5,6'],
        'nav_type' => ['require','number','in' => '1,2'],
        'nav_path' => 'require',
        'path_type' => ['require','number','in' => '1,2'],
    ];

    protected $message = [
        'nav_id.require' => '参数不能为空',
        'nav_id.number'  => '参数不合法',
        'nav_name.require' => '导航名称不能为空',
        'nav_seat.require' => '导航位置不能为空',
        'nav_seat.number'  => '导航位置格式错误',
        'nav_seat.in'      => '导航位置不合法',
        'nav_type.require' => '导航类型不能为空',
        'nav_type.number'  => '导航类型格式错误',
        'nav_type.in'      => '导航类型不合法',
        'path_type.require' => '跳转方式不能为空',
        'path_type.number'  => '跳转方式格式错误',
        'path_type.in'      => '跳转方式不合法',
        'nav_path.require' => '跳转地址不能为空',
    ];

    protected $scene = [
        'add_jump' => ['nav_name','nav_seat','nav_type','path_type','nav_path'],
        'add_not'  => ['nav_name','nav_seat','nav_type'],
        'edit_jump' => ['nav_name','nav_seat','nav_type','path_type','nav_path','nav_id'],
        'edit_not'  => ['nav_name','nav_seat','nav_type','nav_id'],
    ];

}